home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.12 (10-Feb-92), Gerald Fitton, R4000 2915 6625 6368
- %OP%TNN
- %OP%DP0
- %OP%IRY
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%PT1
- %OP%PDPipeLine
- %OP%WC2,1238,44,980,0,21,0,21
- %OP%NDn_01,B123
- %OP%NDn_02,B124
- %OP%FR0,2
- %CO:A,60,72%Comments and Commands
-
- ------------------------------------------------------------------------
-
- Function "add_anything"
-
- Although this custom function could be considerably simplified, it does
- illustrate many points which are fundamental (see the ReadMe file). It
- accepts a parameter called "p_01" (which must be a number) and returns
- (p_01 + 1). You can change the number added by changing the second
- argument of the command - set_value(B25,1) - of slot A25. Try changing
- slot A25 to set_value(B25,2). If you disable - set_value(B25,1) - in
- A25 then you can enter a value directly into B25.
-
- The commands in slots A34A36 are unnecessary to the execution of the
- custom function. They write the current values of slots A25, A28 and
- A31 to C25, C28 and C31 respectively. By doing this you can see what
- values were contained in them at the time the set_value(C#,A#) command
- was executed. If your custom function has 'bugs' then you will find
- such lines helpful.
-
- %V%%L%function("add_anything","p_01:number")
-
- Use the slot B25 as a local value
- %V%%L%set_value(B25,1)
-
- What value has the parameter?
- %V%%L%@p_01
-
- Process the data: find (p_01 + B25)
- %V%%L%@p_01+B25
-
- Keep track of what's happening
- %V%%L%set_value(C25,B25)
- %V%%L%set_value(C28,A28)
- %V%%L%set_value(C31,A31)
-
- Return the result
- %V%%L%result(A31)
- ------------------------------------------------------------------------
-
- Function "use_slots"
-
- This custom function accepts two parameters called "p_01" and "p_02"
- and adds them together before returning the result. Again, adding two
- parameters together could be greatly simplified to the single line -
- ... return(@@p_01+@@p_02) - but, as it is written, it does illustrate
- some useful points (see the ReadMe file). The - set_value(C#,A#) -
- commands in A76A79 keep track of the values taken by the slots in the A
- column. The 'commands' @@p_01 & @@p_02 in A61A62 hold the parameter
- values. As in the previous custom function, this does enable you to
- see what is happening and it is useful for debugging. In A65A66 the
- two parameters are addigned to two 'local' variables, the slots B65
- &B66. The values of the local variables are changed by the commands in
- A69A70 before they are added in A73. Note that the parameters require
- an @@ symbol to convert the string, "p_01" to the number @@p_01.
-
- %V%%L%function("use_slots","p_01:number","p_02:number")
-
- What values have the parameters?
- %V%%L%@p_01
- %V%%L%@p_02
-
- Assign the values of the parameters to local variables
- %V%%L%set_value(B65,@p_01)
- %V%%L%set_value(B66,@p_02)
-
- Change the values of the 'local' variables B65 & B66
- %V%%L%set_value(B65,B65+1)
- %V%%L%set_value(B66,B66-1)
-
- Process the data by adding the slots (B65 + B66)
- %V%%L%B65+B66
-
- Keep track of what's happening
- %V%%L%set_value(C61C62,A61A62)
- %V%%L%set_value(C65C66,A65A66)
- %V%%L%set_value(C69C70,A69A70)
- %V%%L%set_value(C73,A73)
-
- Return the result
- %V%%L%result(A73)
- ------------------------------------------------------------------------
-
- Function "use_names"
-
- This custom function introduces the use of a 'name' for a variable.
- Two 'names', "n_01" and "n_02" are declared by the
- set_name("name",slotref) commands in slots A123 & A124. When a 'name'
- is declared in a custom function it is good practice to assign a slot
- rather than a value to the name. In this case the slots B123 & B124
- have been assigned to the 'names' "n_01" and "n_02" respectively.
-
- In a custom function a 'name' must be declared only once. The 'name'
- is declared with the command - set_name(name,slotref). After declaring
- the 'name' of the variable you may assign a new value to that 'name' as
- many times as you wish using the command - set_value(name,value). When
- you change the value of a name the value in the slots assigned to that
- name will also change.
-
- The commands in slots A127 & A128 assign the values of the two
- parameters, "p_01" & "p_02" to the two names "n_01" & "n_02". Notice
- that when this command is executed new values of the 'names' are
- relayed to and stored in the two slots B123 & B124. The command in
- A138, - set_value(C123C124,A123A124), is included to show that the
- values in A123 & A124 are not changed by the commands in A127, A128,
- A131 & A132! However, these last four commands do change the values of
- the two 'names' and the values in the slots B123 & B124.
-
- Contrast the use of 'names' in this custom function with the use of
- parameters in "use_slots". Values such as "p_01" have to be written as
- @@p_01 to become a value whereas the 'name' "n_01" is a value when
- written as n_01. The command set_name("name",slotref) requires
- inverted commas around the 'name' because, within the set_name command,
- "n_01" is a text string. The addition, n_01+n_02, in slot A135 does
- not require inverted commas around the 'names' nor do the 'names' need
- to be preceded by @@; n_01 is the value taken by the 'name' "n_01".
-
-
- %V%%L%function("use_names","p_01:number","p_02:number")
-
- Declare the 'names' of the variables and the slots they will use
- %V%%L%set_name("n_01",B123)
- %V%%L%set_name("n_02",B124)
-
- Assign values to the named variables
- %V%%L%set_value(n_01,@p_01)
- %V%%L%set_value(n_02,@p_02)
-
- Modify the values of the named variables
- %V%%L%set_value(n_01,n_01+1)
- %V%%L%set_value(n_02,n_02-1)
-
- Process the data by finding (n_01 + n_02)
- %V%%L%n_01+n_02
-
- Keep track of what's happening
- %V%%L%set_value(C123C124,A123A124)
- %V%%L%set_value(C127C128,A127A128)
- %V%%L%set_value(C131C132,A131A132)
- %V%%L%set_value(C135,A135)
-
- Return the result
- %V%%L%result(A135)
- ------------------------------------------------------------------------
- %CO:B,6,0%Value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%2
- %V%%R%1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%2
- %V%%R%1
- %CO:C,6,0%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%1
-
-
- %V%%R%0
-
-
- %V%%R%1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%1
- %V%%R%2
-
-
- %V%%R%1
- %V%%R%2
-
-
- %V%%R%2
- %V%%R%1
-
-
- %V%%R%3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- %V%%R%3
- %V%%R%4
-
-
- %V%%R%1
- %V%%R%2
-
-
- %V%%R%2
- %V%%R%1
-
-
- %V%%R%3
- %V%%R%""
-